package jp.syuriken.snsw.terenaibot.internal;

import java.util.Date;

import jp.syuriken.snsw.terenaibot.Post;
import twitter4j.Status;
import twitter4j.User;

/**
 * {@link twitter4j.Status}を使用した{@link Post}。
 * 
 * @author $Author: snswinhaiku.lo@gmail.com $
 */
public class TwitterPost extends Post {
	
	private String postId;
	
	private String postText;
	
	private String postUser;
	
	private String inReplyToUserId;
	
	private String inReplyToPostId;
	
	private String source;
	
	private Date createdAt;
	
	private Status original;
	
	private String postUserName;
	

	/**
	 * {@link twitter4j.Status}を使用してインスタンスを生成する。
	 * 
	 * @param status ステータスインスタンス。
	 */
	public TwitterPost(twitter4j.Status status) {
		postId = String.valueOf(status.getId());
		postText = status.getText();
		createdAt = status.getCreatedAt();
		inReplyToUserId = status.getInReplyToScreenName();
		inReplyToPostId = String.valueOf(status.getInReplyToStatusId());
		source = status.getSource();
		
		User user = status.getUser();
		postUser = String.valueOf(user.getId());
		postUserName = user.getScreenName();
		
		original = status;
		
	}
	
	@Override
	public Date getCreatedAt() {
		return (Date) createdAt.clone();
	}
	
	@Override
	public String getInReplyToPostId() {
		return inReplyToPostId;
	}
	
	@Override
	public String getInReplyToUserId() {
		return inReplyToUserId;
	}
	
	@Override
	public Object getOriginal() {
		return original;
	}
	
	@Override
	public String getPostId() {
		return postId;
	}
	
	@Override
	public String getPostText() {
		return postText;
	}
	
	@Override
	public String getSource() {
		return source;
	}
	
	@Override
	public String getUser() {
		return postUser;
	}
	
	@Override
	public String getUserName() {
		return postUserName;
	}
	
}
